<template>
    <div class="gitee-page">
        <NavigationBar />

        <h1>项目代码仓库</h1>
        <p class="subtitle">请选择要查看的项目仓库：</p>

        <div class="repo-buttons">
            <button v-for="repo in repositories" :key="repo.id" class="repo-button" @click="openRepository(repo.url)">
                <span class="repo-icon">📦</span>
                <span class="repo-name">{{ repo.name }}</span>
            </button>
        </div>

        <div class="note">
            <p>所有项目代码开源在 Gitee 平台</p>
        </div>
    </div>
    <Footer />
</template>

<script setup>

import Footer from '@/components/Footer.vue'
import NavigationBar from '@/components/NavigationBar.vue'
const repositories = [
    {
        id: 1,
        name: '宠物之家前端框架版',
        url: 'https://gitee.com/li-xinglian/pet'
    },
    {
        id: 2,
        name: '宠物之家后端框架版',
        url: 'https://gitee.com/li-xinglian/pet2--remake-backend-version'
    },
    {
        id: 3,
        name: '宠物之家后端加料版',
        url: 'https://gitee.com/li-xinglian/pet3-backend'
    },
    {
        id: 4,
        name: '宠物之家最终前端板',
        url: 'https://gitee.com/li-xinglian/pet4'
    },
    {
        id: 5,
        name: '宠物之家最终后端版',
        url: 'https://gitee.com/li-xinglian/pet5'
    }
];

const openRepository = (url) => {
    window.open(url, '_blank');
};
</script>

<style scoped>
.gitee-page {
  margin: 0 auto;
  padding: 40px 20px;
  text-align: center;
  background-color: #faf8f5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1 {
  color: #8b7355;
  margin: 20px 0 15px;
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: 1px;
}

.subtitle {
  color: #a38b6d;
  margin-bottom: 40px;
  font-size: 1.1rem;
  font-style: italic;
}

.repo-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 固定3列 */
  grid-template-rows: repeat(2, 1fr); /* 固定2行 */
  gap: 25px;
  margin: 30px 0 50px;
  padding: 0 20px;
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.repo-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  background-color: #f5f0e6;
  border: 1px solid #e0d5c0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  height: 160px; /* 增加高度 */
  box-shadow: 0 3px 10px rgba(139, 115, 85, 0.08);
  position: relative;
  overflow: hidden;
}

.repo-button:hover {
  background-color: #f0e9db;
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(139, 115, 85, 0.15);
}

.repo-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background-color: #d4b483;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.repo-button:hover::before {
  transform: scaleX(1);
}

.repo-icon {
  font-size: 2.5rem; /* 增大图标 */
  margin-bottom: 15px;
  color: #b89f7b;
}

.repo-name {
  font-size: 1.2rem; /* 增大文字 */
  font-weight: 500;
  color: #6d5c45;
  line-height: 1.4;
}

.note {
  margin-top: 40px;
  color: #a38b6d;
  font-size: 0.95rem;
  padding: 15px;
  background-color: rgba(245, 240, 230, 0.7);
  border-radius: 8px;
  display: inline-block;
}

/* 响应式设计 - 在小屏幕上改为2列3行 */
@media (max-width: 768px) {
  .repo-buttons {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 20px;
  }
  
  .repo-button {
    height: 140px;
    padding: 25px 15px;
  }
}

/* 在更小的屏幕上改为单列 */
@media (max-width: 480px) {
  .repo-buttons {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(6, auto);
  }
  
  .gitee-page {
    padding: 30px 15px;
  }
  
  h1 {
    font-size: 1.9rem;
  }
  
  .repo-name {
    font-size: 1.1rem;
  }
}
</style>